<template>
	<view class="bg min100">
		<!-- <u-sticky h5-nav-height="0">
			<view class="status_bar bg-blue">
			</view>

			<view class="bg-blue white">
				<view class="center pd-20">
					<view class="size-34 mr-10">消息</view>
				</view>

			</view>
		</u-sticky> -->
		<view class="cu-custom" :style="{height: $wanlshop.wanlsys().height + 'px' }">
			<view class="cu-bar fixed" :style="{
				height: $wanlshop.wanlsys().height + 'px', 
				paddingTop: $wanlshop.wanlsys().top + 'px',
				color: '#333333',
				backgroundColor: '#fff',
			}">
				<view class="action" @tap="$wanlshop.on('/pages/index')">
					<text class="wlIcon-fanhui1"></text>
				</view>
				<view class="content text-bold" :style="{top: $wanlshop.wanlsys().top + 'px'}">
					消息
				</view>
				<view class="action">
					<text class="iconfont icon-ipr_shouye text-bold" style="font-size: 44rpx;"></text>
				</view>
			</view>
		</view>
		<view class="pd-30">
			<wanl-empty  v-if="!list||list.length==0" text="暂无消息"></wanl-empty>


			<view v-for="(v,i) in list" :key="i" style="background-color: #FFFFFF;padding: 8px;margin-bottom: 29px;">
				<view style="display: flex;align-items: center;justify-content: space-between;">
					<view style="display: flex;align-items: center;">
						<image style="height: 27px;width: 27px;" src="/static/img/message.png" mode=""></image>

						<view style="margin-left: 8px;font-size: 17px;
font-family: PingFang SC;
font-weight: bold;
color: #000000;">
							系统消息
						</view>

					</view>
					<view style="font-size: 13px;
font-weight: 500;
color: #9D9E9E;">
						{{ v.createtime  | formatData}}
					</view>
				</view>
				<view style="font-size: 14px;
margin-top: 15px;

font-weight: 500;
color: #747474;
line-height: 19px;">
					{{ v.memo }}
				</view>
			</view>
			<u-loadmore v-show="list&&list.length>9" :status="status" icon-type="flower" bg-color="transperant"
				margin-top="30" margin-bottom="30" />
		</view>
		<u-tabbar v-model="currentTab" :list="listTab" active-color="#120062" @change="jump"></u-tabbar>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				index: 1,
				current: '',
				timer3: null,
				page: 1,
				status: 'loadmore',
				list: '',
				currentTab: 1, // 底部
				listTab: [ {
						"pagePath": "/pages/driver/order/index",
						"iconPath": "/static/tabbar/2.png",
						"selectedIconPath": "/static/tabbar/2-2.png",
						"text": "订单"
					}, {
						"pagePath": "/pages/driver/message/index",
						"iconPath": "/static/tabbar/5.png",
						"selectedIconPath": "/static/tabbar/5-1.png",
						"text": "消息"
					},
					{
						"pagePath": "/pages/driver/my/index",
						"iconPath": "/static/tabbar/3.png",
						"selectedIconPath": "/static/tabbar/3-3.png",
						"text": "我的"
					}
				], // 底部
			}
		},
		computed: {
			...mapState(['tabList'])
		},
		onShow() {
			this.timer12 = setInterval(() => {
				this.getMessage()
			}, 10000)
		},
		onUnload() {
			clearInterval(this.timer12)
		},
		onHide() {
			clearInterval(this.timer12)
		},
		filters: {

			//过滤器 用于格式化时间
			formatData(value) {
				var date = new Date(parseInt(value + '000'));
				//date.setTime(value);
				var month = date.getMonth() + 1;
				var hours = date.getHours();
				if (hours < 10)
					hours = "0" + hours;
				var minutes = date.getMinutes();
				if (minutes < 10)
					minutes = "0" + minutes;
				var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
					" " + hours + ":" + minutes;
				return time;

			}

		},

		onLoad() {
			this.getMessage()
		},

		methods: {
			jump(e) {
				console.log(e)
				uni.navigateTo({
					url: this.listTab[e].pagePath
				})
			},
			getMessage() {
				console.log('23156');
				this.$http('/addons/ddrive/order/message', {

				}, 'POST').then(res => {
					this.listPage = res.code
					this.list = res
					console.log(res);
				})
			},
		}
	}
</script>

<style scoped lang="scss">

</style>